package main

import "fmt"

func main() {
	//ScoreMark()
	//traverseString()
	//traverseSlice()
	printRightTriangle()
}
func ScoreMark() {
	score := 78
	if score >= 90 {
		fmt.Println("优秀")
	} else if score > 80 {
		fmt.Println("良好")
	} else {
		fmt.Println("你就是个辣鸡")
	}
}

func traverseString(){
	str:="123456ABCDefghij吾问无为谓 klmn"
	for i,value:=range str{
		fmt.Printf("第%d的字符是：%v,值是%c,\n",i,value,value)
	}
}

//遍历切片
func traverseSlice(){
	arr:=[]int{100,200,300}
	for i,value:=range arr {
		fmt.Println(i,":",value)
	}
}

//for嵌套循环
func printRightTriangle(){
	//定义行数
	lines:=8
	for i:=0;i<lines ;i++  { 
		for n:=0; n<2*i+1;n++  {
			fmt.Print("*")
		}
		fmt.Println()
	}
}
